namespace DataClasses
{
    using System;

    /// <summary>
    /// Album model
    /// </summary>
    public class Album : ActiveRecord<Album>
    {
        private string _name;
        private Guid _idArtist;

        /// <summary>
        /// Empty constructor for getting entities needs
        /// </summary>
        public Album()
        {
        }

        /// <summary>
        /// Constructor of the Album
        /// </summary>
        /// <param name="name"></param>
        public Album(string name)
        {
            Id = Guid.NewGuid();
            Name = name;
            this.Save();
        }

        public Album(string name, Guid idArtist)
        {
            Id = Guid.NewGuid();
            ArtistId = idArtist;
            Name = name;
            this.Save();
        }

        public Album(Guid id, string name, int count)
        {
            Id = id;
            Name = name;
            SongCount = count;
            this.Save();
        }

        /// <summary>
        /// Title of album
        /// </summary>
        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        /// <summary>
        /// Count of songs in album
        /// </summary>
        public int SongCount
        {
            get { return _songcount; }
            set { _songcount = value; }
        }

        public Guid ArtistId
        {
            get { return _idArtist; }
            set { _idArtist = value; }
        }

    public override object[] Objparams
        {
            get
            {
                objects = new object[4];
                objects[0] = Id.ToString();
                objects[1] = ArtistId.ToString();
                objects[2] = Name;
                objects[3] = SongCount;
                return objects;
            }

            set
            {
                objects = value;
                Id = new Guid(objects[0].ToString());
                ArtistId = new Guid(objects[1].ToString());
                Name = (string)objects[2];
                SongCount = (int)objects[3];
            }
        }

        private int _songcount
        {
            get { return 4; }
            set { }
        }
    }
}
